package fr.esiag.isidis.fi.pdsTeam.presentation;

import java.awt.Adjustable;
import java.awt.Dimension;
import java.awt.GridLayout;

import javax.swing.*;

import fr.esiag.isidis.fi.pdsTeam.UDP.RawInformationReceiver;

public class ReceiverFrame extends JFrame{
	
	private static final long serialVersionUID = 862960466847268055L;

    private JTable informationsTable;
    JScrollBar scrollBarVertical = new JScrollBar();
    JScrollBar scrollbarHorizontal = new JScrollBar(Adjustable.HORIZONTAL);
    
    private RawInformationReceiver receiver = new RawInformationReceiver();
    
	ReceiverFrame() throws InterruptedException {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setSize(900, 600);
		this.setTitle("MOCK | Generated events reception");
		
		scrollBarVertical.setPreferredSize(new Dimension(20, 200));
	    scrollbarHorizontal.setPreferredSize(new Dimension(200, 20));
	    
		this.setLayout(new GridLayout(0,1));
		
		
		informationsTable = new JTable(receiver.getInformtions());
		getContentPane().add("Center",new JScrollPane(informationsTable));

		 
		informationsTable.add(scrollBarVertical);
		informationsTable.add(scrollbarHorizontal);
		
		setVisible(true);
		
		receiver.start();
	}
	
	public static void main(String args[]) throws InterruptedException {
		new ReceiverFrame();
	}
}
